#!/bin/bash

counter=0
sourceName=$1
targetName=$2
maxPercent=$3
flag=true

percent=$(df -P | grep -w "/" | awk '{print $5}' | cut -d'%' -f1)

now=${percent[0]}
echo "now is : $now"

while(( $now<$maxPercent ))
do
	cp -r -p ./$sourceName ./$targetName
	mv ./$targetName/$sourceName ./$targetName/"${sourceName%*/}"_"${counter}"
	echo "${sourceName%*/}"_"${counter}"
	let "counter++"
	percent=$(df -P | grep -w "/" | awk '{print $5}' | cut -d'%' -f1)
	now=${percent[0]}
	echo "now is : $now"
done






